'use strict';
layui.define(['jquery','swiper','element'], function(exports){
    let $ = layui.jquery
        ,swiper = layui.swiper;

    let obj = {
        btn : null,
        list: null,

        secNav : '',
        secNavNextEl : '',
        secNavPrevEl : '',

        init:function(){
            let that = this;
            this.btn = $('#main_nav_btn');
            this.list = $('#main_nav_list');
            this.secNav = '#nav_swiper';
            this.secNavNextEl = '#nav_next';
            this.secNavPrevEl = '#nav_prev';

            /*主导航*/
            this.btn.on('click', function(){
                that.list.toggleClass('layui-hide-xs');
            });

            /*次导航*/
            new swiper(this.secNav,{
                slidesPerView : 'auto',
                navigation: {
                    nextEl: this.secNavNextEl,
                    prevEl: this.secNavPrevEl,
                },
            });
        }
    };


    //输出test接口
    obj.init();
    exports('nav', obj);
});